package game.modes;

import hx.utils.SceneManager;
import game.worlds.PK1V1World;
import game.views.RoleSelectView;
import game.views.FightReadyView;

/**
 * 1V1PK模式
 */
class PK1V1Mode extends Mode {
	override function enterInitScene() {
		var view = new RoleSelectView();
		view.selected2pEnabled = true;
		view.onRoleSelected = (roles:Array<Dynamic>) -> {
			// 战斗选项准备
			var readyView = new FightReadyView();
			SceneManager.getInstance().replaceScene(readyView);
			var gameWorld = new PK1V1World({
				roles: [
					{
						id: roles[0].roleid,
						loadType: roles[0].abn == "1" ? ABN_DATA : HXWZ2_DATA
					},
					{
						id: roles[1].roleid,
						loadType: roles[1].abn == "1" ? ABN_DATA : HXWZ2_DATA
					}
				],
				player1: roles[0].roleid,
				player2: roles[1].roleid
			});
			gameWorld.stateDebug = false;
			ModeManage.readyWorld(gameWorld);
		}
		SceneManager.getInstance().replaceScene(view);
	}
}
